ModelLocator = function() {

	if ( ModelLocator.instance != null )
	{
		throw( "Singleton class has already been instantiated" );
	} else
	{
		ModelLocator.instance = this;
		// Private properties
		  var _config = new Config();
		  var _state = new State();
		  var _security = new Security();
		  var _domains = [];

		  // Define our getters and setters
		  this.addProperties({
		    config: {
		      get: function() {
		        return _config;
		      },
		      set: function(val) {
		    	  _config = val;
		    	  this.Notify( val, "config" );
		      }
		    },
		    domains: {
			      get: function() {
			        return _domains;
			      },
			      set: function(val) {
			    	  _domains = val;
			    	  this.Notify( val, "domains" );
			      }
			    },
		    security: {
			      get: function() {
			        return _security;
			      },
			      set: function(val) {
			    	  _security = val;
			    	  this.Notify( val, "security" );
			      }
			    },
		    state: {
			      get: function() {
			        return _state;
			      },
			      set: function(val) {
			    	  _state = val;
			    	  this.Notify( val, "state" );
			      }
			    }
		  }
		)
	}
};

/************* Inherit from Subject for data binding *************/
ModelLocator.prototype = new Subject();
	
ModelLocator.getInstance = function(){
	if (ModelLocator.instance == null) {
		ModelLocator.instance = new ModelLocator();
	}
	return ModelLocator.instance;
}

ModelLocator.instance;